<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/10/11
  Time: 11:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>account</title>
    <link type="text/css" rel="stylesheet" media="all" href="<%=request.getContextPath()%>/styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="<%=request.getContextPath()%>/styles/global_color.css"/>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <%--<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">--%>
    <script language="javascript" type="text/javascript">
        //删除
        function deleteAccount() {
            var r = window.confirm("确定要删除此账务账号吗？\r\n删除后将不能恢复，且会删除其下属的所有业务账号。");
            document.getElementById("operate_result_info").style.display = "block";
        }

        //开通或暂停
        function setState() {
            var r = window.confirm("确定要开通此账务账号吗？");
            document.getElementById("operate_result_info").style.display = "block";
        }

    </script>
</head>
<body>
<!--Logo区域开始-->
<div id="header">
    <img src="../images/logo.png" alt="logo" class="left"/>
    <a href="<%=request.getContextPath()%>/admins/exit">[退出]</a>
</div>
<!--Logo区域结束-->
<!--导航区域开始-->
<div id="navi">
    <c:import url="../navigation.jsp"/>
    <script>
        var li = document.getElementById("menu").children;
        var title = document.getElementsByTagName('title')[0].textContent;
        for (let i = 0; i < li.length; i++) {
            if (li[i].children[0].className.startsWith(title)){
                li[i].children[0].className = title + '_on';
            }
        }
    </script>
</div>
<!--导航区域结束-->
<!--主要区域开始-->
<div id="main">
    <form method="post" action="<%=request.getContextPath()%>/account.page">
        <!--查询-->
        <div class="search_add">
            <div>身份证：<input type="text" name="idcardNo" class="text_search"/></div>
            <div>姓名：<input type="text" class="width70 text_search" name="realName"/></div>
            <div>登录名：<input type="text" name="loginName" class="text_search"/></div>
            <div>
                状态：
                <select name="status" class="select_search">
                    <c:if test="${status.equals('')|| status == 0}">
                        <option value="" name="status" selected="selected">全部</option>
                        <option value="1">开通</option>
                        <option value="2">暂停</option>
                        <option value="3">删除</option>
                    </c:if>
                    <c:if test="${status == 1}">
                        <option value="">全部</option>
                        <option value="1" name="status" selected="selected">开通</option>
                        <option value="2">暂停</option>
                        <option value="3">删除</option>
                    </c:if>
                    <c:if test="${status == 2}">
                        <option value="">全部</option>
                        <option value="1">开通</option>
                        <option value="2" name="status" selected="selected">暂停</option>
                        <option value="3">删除</option>
                    </c:if>
                    <c:if test="${status == 3}">
                        <option value="">全部</option>
                        <option value="1">开通</option>
                        <option value="2">暂停</option>
                        <option value="3" name="status" selected="selected">删除</option>
                    </c:if>
                </select>
                <input type="submit" value="搜索" class="btn_search"/>
                <input type="button" value="增加" class="btn_add"
                       onclick="location.href='<%=request.getContextPath()%>/account/account_add.jsp';"/>
            </div>
        </div>
        <div id="data">
            <table id="datalist">
                <tr>
                    <th>账号ID</th>
                    <th>姓名</th>
                    <th class="width150">身份证</th>
                    <th>登录名</th>
                    <th>状态</th>
                    <th class="width100">创建日期</th>
                    <th class="width150">上次登录时间</th>
                    <th class="width200"></th>
                </tr>
                <c:forEach items="${accountList}" var="list">
                    <tr>
                        <td>${list.accountId}</td>
                        <td>
                            <a href="<%=request.getContextPath()%>/account.detail?accountId=${list.accountId}">${list.realName}</a>
                        </td>
                        <td>${list.idcardNo}</td>
                        <td>${list.loginName}</td>
                        <c:if test="${list.status == 1}">
                            <td>开通</td>
                        </c:if>
                        <c:if test="${list.status == 2}">
                            <td>暂停</td>
                        </c:if>
                        <c:if test="${list.status == 3}">
                            <td>删除</td>
                        </c:if>
                        <td>${list.createDate}</td>
                        <td>${list.lastLoginTime}</td>
                        <c:if test="${list.status == 1 || list.status == 2}">
                            <td class="td_modi">
                                <c:if test="${list.status == 1}">
                                    <input type="button" value="暂停" class="btn_pause"
                                           onclick="location.href='/status.do?accountId=${list.accountId}&status=2&page=${currentPage}';"/>
                                </c:if>
                                <c:if test="${list.status == 2}">
                                    <input type="button" value="开通" class="btn_pause"
                                           onclick="location.href='/status.do?accountId=${list.accountId}&status=1&page=${currentPage}';"/>
                                </c:if>
                                <input type="button" value="修改" id="modify" class="btn_modify"
                                       onclick="location.href='/account.modifyInfo?accountId=${list.accountId}';"
                                />
                                <input type="button" value="删除" class="btn_delete"
                                       onclick="location.href='/status.do?accountId=${list.accountId}&status=3&page=${currentPage}';"/>
                            </td>
                        </c:if>
                    </tr>
                </c:forEach>
            </table>
            <p>业务说明：<br/>
                1、创建则开通，记载创建时间；<br/>
                2、暂停后，记载暂停时间；<br/>
                3、重新开通后，删除暂停时间；<br/>
                4、删除后，记载删除时间，标示为删除，不能再开通、修改、删除；<br/>
                5、暂停账务账号，同时暂停下属的所有业务账号；<br/>
                6、暂停后重新开通账务账号，并不同时开启下属的所有业务账号，需要在业务账号管理中单独开启；<br/>
                7、删除账务账号，同时删除下属的所有业务账号。</p>
        </div>
        <!--分页-->
        <div id="pages">
            <button id="p" name="page" value="1">首页</button>
            <button id="p" name="page" value="${currentPage - 1}">上一页</button>
            <c:forEach varStatus="i" begin="0" end="${totalPage -1 }">
                <button id="p2" name="page" value="${i.count}">${i.count}</button>
            </c:forEach>
            <button id="p" name="page" value="${currentPage + 1}">下一页</button>
            <button id="p" name="page" value="${totalPage}">末页</button>
            <%--<input type="hidden" value="0" id="starTime" name="page"/>--%>
        </div>

    </form>

    <script>
        $(function () {
            $('#pages').click(function () {
                var ss = $(this).attr("page");
            })
        })

    </script>
</div>
<!--主要区域结束-->
<div id="footer">
    <p>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
    <p>版权所有(C)云科技有限公司 </p>
</div>
</body>
</html>
